if (isDedicated) exitWith {}; //

//by 略游。不播动画效果最好


dokeyDown={
     private ["_r","_key_delay","_max_height"] ;
     _key_delay  = 0.1;// 按键间最大时间 
     _max_height = 6.3;// 最大跳跃高度
     // player setvariable ["key",false];// 通过删除/ /开始时启用这条线进行单按键
   _r = false ; 
     
   //  HINT STR (_this select 1);// 显示键号
   
   // 各种检查 
   if (player getvariable["key",true] and (_this select 1)  == 46) exitwith {player setvariable["key",false]; [_key_delay] spawn {sleep (_this select 0);player setvariable["key",true]; };_r};
     if ((_this select 1)  == 46 and speed player >8) then {
       if  (player == vehicle player  and player getvariable ["jump",true] and isTouchingGround player ) then  {
   
    player setvariable["key",true];// 双键抽头    
    player setvariable ["jump",false];// 禁用跳转
    
   _height = 600-((load player)*10);// 基于权重降低高度
   //hint str _height;

// 向右跳
_vel = velocity player;
_dir = direction player;
_speed = 0.4;
If (_height > _max_height) then {_height = _max_height};// 最大跳跃高度
player setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)+_height];

     player spawn {sleep 2;_this setvariable ["jump",true]};// RE-ENABLE JUMP
    
   };
    _r=true;
      };
     _r;
} ;

waituntil {!(IsNull (findDisplay 46))};
(FindDisplay 46) displayAddEventHandler ["keydown","_this call dokeyDown"];

0 spawn {uiSleep 10; systemChat "添加前进中长按C键跳跃"};

